package com.xpgk.mvc.collection.bentryRegister;

import java.util.List;

import com.jfinal.log.Log;
import com.xpgk.annotation.Table;
import com.xpgk.mvc.base.BaseModel;


/**
 * 顾客信息登记model
 */
@SuppressWarnings("unused")
@Table(tableName = CollectionCustomerProductSurplus.table_name)
public class CollectionCustomerProductSurplus extends BaseModel<CollectionCustomerProductSurplus> {
		

	/**
	 * 字段描述：该条数据添加人员is  字段类型：character varying 长度：32
	 */
	public static final String column_createId = "createId";
	/**
	 * 字段描述：该条数据添加时间  字段类型：datetime 长度：0
	 */
	public static final String column_createDate = "createDate";
	/**
	 * 字段描述：该条数据更新人员id  字段类型：character varying 长度：100
	 */
	public static final String column_updateId = "updateId";
	/**
	 * 字段描述：该条数据更新时间  字段类型：datetime 长度：0
	 */
	public static final String column_updateDate = "updateDate";
	/**
	 * 
	 */
	private static final long serialVersionUID = -8806606891114580824L;

	private static final Log log = Log.getLog(CollectionCustomerProductSurplus.class);

	public static final CollectionCustomerProductSurplus dao = new CollectionCustomerProductSurplus().dao();
	
	
	
	/**
	 * 表名称
	 */
	public static final String table_name = "sb_customer_product_surplus";
	
	/**
	 * 字段描述：ids 字段类型：character varying 长度：11
	 */
	public static final String column_ids = "ids";
	/**
	 * 字段描述：机构id 字段类型：character varying 长度：32
	 */
	public static final String column_organIds= "organIds";
	/**
	 * 字段描述：customerID 字段类型：character varying 长度：11
	 */
	public static final String column_customerIds = "customerIds";

	/**
	 * 字段描述：产品ID 字段类型：character varying 长度：11
	 */
	public static final String column_productIds = "productIds";

	/**
	 * 字段描述：产品数量 字段类型：bigint  长度：11
	 */
	public static final String column_count = "count";
	/**
	 * 字段描述：产品经验值    字段类型：float 长度：11
	 */
	public static final String column_proprice = "proprice";
	/**
	 * 字段描述：产品经验值    字段类型：float 长度：11
	 */
	public static final String column_totalprice = "totalprice";

	/**
	 * 字段描述：产品经验值    字段类型：float 长度：11
	 */
	public static final String column_proExperience = "proExperience";
	/**
	 * 字段描述：产品剩余总经验值   字段类型：float 长度：11
	 */
	public static final String column_totalExperience = "totalExperience";
	/**
	 * 字段描述：更新时间
	 */
	public static final String column_gxsj = "gxsj";

	/**根据顾客，产品，机构，时间查出明细
	 * 
	 * @param customerIds
	 * @param productIds
	 * @param organIds
	 * @param date
	 * @return
	 */
	public  CollectionCustomerProductSurplus   getCustomerProductSurplus(String customerIds,String productIds,String organIds,String date)
	{
		String sql="SELECT  *  FROM  sb_customer_product_surplus    WHERE  customerIds=? and  productIds=? and  organIds=?  and  gxsj like ?";
		return  CollectionCustomerProductSurplus.dao.findFirst(sql,customerIds,productIds,organIds,date);
	}
	
	public  List<CollectionCustomerProductSurplus>  getCusProSurList(String customerIds,String outorganIds,String date)
	{
		String sql = "SELECT  *,sys_getProductByColumn(productIds,'name') proname  FROM  sb_customer_product_surplus  scps  WHERE organIds=?  and customerIds=?  and  gxsj like ?";
		return  CollectionCustomerProductSurplus.dao.find(sql,outorganIds,customerIds,date);
	}
}
